#ifndef WIDGET_H
#define WIDGET_H

#include <QFileSystemModel>
#include <QTreeView>
#include <QWidget>
#include <QMessageBox>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QStandardItemModel>
#include <QAuthenticator>
#include <QVBoxLayout>
#include <QHeaderView>
#include <QPushButton>
#include <QModelIndex>
#include <QProgressDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
    class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget {
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void onNetworkReply(QNetworkReply *reply);
    void onTreeViewDoubleClicked(const QModelIndex &index);
    void onDownloadButtonClicked();
    void onRefreshButtonClicked();

private:
    Ui::Widget *ui;
    QTreeView *treeView = nullptr;
    QNetworkAccessManager *manager;
    QStandardItemModel *fileModel;
    QString currentPath;
    void sendRequest(const QString &path);
    QString getSelectedItemPath();
};
#endif  // WIDGET_H
